<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <script src="../jquery/jquery.min.js"></script>
    <script src="echarts.min.js"></script>
    <title></title>
</head>
<script>

    $(function(){
        $("#main").height($(window).height()*0.98);
        drawUnitBar();
    });

    $(window).resize(function(){
        $("#main").width($(window).width()*0.98);
        $("#main").height($(window).height()*0.98);
        drawUnitBar();
    });

    function drawUnitBar(){
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts 入门示例'
            },
            tooltip: {},
            toolbox:{

            },
            dataZoom: [{
                type: 'slider',
                show: true,
                xAxisIndex: [0],
                start: 1,
                end: 35
            },{
                type: 'slider',
                show: true,
                yAxisIndex: [0],
                left: '91%',
                start: 29,
                end: 36
            },{
                type: 'inside',
                xAxisIndex: [0],
                start: 1,
                end: 35
            },{
                type: 'inside',
                yAxisIndex: [0],
                start: 29,
                end: 36
            }],
            legend: {
                data:['销量']
            },
            xAxis: {
                data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子","猪头","狗头","羊头","鸡头"]
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20,15,21,22,10]
            }]
        };
        window.onresize = myChart.resize;
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }
</script>
<body>
    <div id="main" style="width: 100%;height:400px;"></div>
</body>
</html>